package moon.voice.service;

import com.hankcs.hanlp.HanLP;
import com.hankcs.hanlp.seg.Segment;
import com.hankcs.hanlp.seg.common.Term;

import java.util.List;

public class HanLpTest {

    public static void main(String[] args) {
        // 创建分词器
        Segment segment = HanLP.newSegment();
        // 对文本进行分词
        List<Term> termList = segment.seg("碧海年年，试问取，冰轮为谁圆缺");
        // 遍历分词结果
        for (Term term : termList) {
            System.out.println(term.word);
        }
    }
}
